/*
 * Author: 李波(Edwin Lee)
 * Date: 2024-07-07 23:30:18
 * FilePath: /code/C/Strcpy/main.c
 * LastEditTime: 2024-08-02 12:58:08
 * version: 1.0
 * Description: 
 */
#include <stdio.h>
#include <stdlib.h>
int main() {
	//测试一：strncpy拷贝后的情况(内存中调试查看）
	//char str1[32] = "helloworld";
	//char str2[6] = { 'w','o','r','l','d','\0' };
	//strncpy(str1, str2, 3);//结果str1中是worloworld，说明strncpy会复制n个字符，而且后面不会添加\0

	//测试二：strncpy对\0的复制情况
	char str1[32] = "helloworld";
	char str2[6] = { 'w','\0','r','l','d','\0' };
	strncpy(str1, str2, 5);//结果str1是w\0\0\0\0\0world\0,说明strncpy复制到\0后会把剩余的复制字符全部置为0
	return 0;
}